import { defineStore } from 'pinia'
import { ElLoading } from 'element-plus'

const useElementPlusStore = defineStore('useElementPlusStore', {
  state: () => ({
    loadInstance: null as any,
  }),
  actions: {
    startLoad() {
      this.loadInstance = ElLoading.service({
        lock: true,
        text: '加载ing......',
        background: 'rgba(0, 0, 0, 0.7)',
        fullscreen: true,
      })
    },
    closeLoad() {
      this.loadInstance.close()
    },
  },
  getters: {},
})

export default useElementPlusStore
